﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPage : System.Web.UI.MasterPage
{
    public string username=null;
    protected void Page_Load(object sender, EventArgs e)
    {

       
        if (!Page.IsPostBack)
        {
            Check_Login();
            //if (Session["UserName"].ToString().Length == 0)
            //{
            //    Response.Write("<script>alert('对不起！请先登录！');location='LoginIndex.aspx'</script>");
            //}
            //else
            //{
                username = Session["UserName"].ToString();
        //    }
       }

    }



    public void Check_Login()
    {
        //判断存储在Session对象中
        if ((Session["UserName"] == null))
        {
            Response.Write("<script>alert('对不起！请先登录！');location='LoginIndex.aspx'</script>");
            Response.End();
        }
    }
}
